package com.itheima.file;

import java.io.*;
import java.util.Arrays;

import static java.lang.Integer.parseInt;

public class BufferedDemo {
    public static void main(String[] args) throws IOException {
        BufferedReader br =new BufferedReader(new FileReader("zuoye//a.txt"));
        String s = br.readLine();
        String[] s1 = s.split(" ");
        int[] arr=new int[s1.length];
        for (int i = 0; i <s1.length ; i++) {
            arr[i] = parseInt(s1[i]);
        }
        Arrays.sort(arr);
        String s2 = Arrays.toString(arr);
        System.out.println(s2);
        System.out.println(s2.length());
        String substring = s2.substring(1, s2.length() - 1);
        System.out.println(new StringBuilder(substring).reverse().toString());
        br.close();
        //创建字符缓冲输出流
        BufferedWriter bw=new BufferedWriter(new FileWriter("zuoye//b.txt"));
        for (int i = 0; i < arr.length; i++) {
            bw.write(arr[i]+" ");
            bw.flush();
        }
        bw.close();
    }
}
